refactor(tabs): rename TabsHost navState prop to navStateRequest#3943
Merged
refactor(tabs): rename TabsHost navState prop to navStateRequest#3943
Conversation
Aligns the public API with RFC-1028's request/state distinction. The
prop carries a *request* for a state change (with `baseProvenance`
identifying the JS-side base it was derived from); the resulting state
arrives back via `OnTabSelected` (with `provenance`). Naming both fields
`provenance` was confusing — they refer to different generations.
- Public TS: `TabsHostNavState` → `TabsHostNavStateRequest`,
field `provenance` → `baseProvenance`, prop `navState` → `navStateRequest`.
- Codegen specs (Android + iOS) updated to match; the C++ Props struct
regenerates automatically.
- Native binding boundary: `setNavStateRequest` override on Android
ViewManager, prop access on iOS `updateProps`.
- Internal native state types (`TabsNavState` Kotlin, `RNSTabsNavigationState`
ObjC) kept — they model state, not requests. Only members that hold the
most recent JS request are renamed (`jsNavState{,Request}`,
`updateJSNavState{,Request}`, `_jsNavState{,Request}`). `TabSelectOp`
payload stays `navState` since the op models a state update at the
container level.
- Apps consumer (`apps/...`) updated in lockstep so the workspace stays
green.
No behavior change.
t0maboro
approved these changes
Apr 28, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aligns the TabsHost API with RFC-1028’s request/state distinction by renaming the navState prop (and its related types/fields) to explicitly represent a request rather than the resulting navigation state.
Changes:
- Renames public TS API:
TabsHostNavState→TabsHostNavStateRequest,provenance→baseProvenance,navState→navStateRequest. - Updates Fabric codegen specs (Android/iOS) to match the new prop/field names.
- Updates native bindings and the example app consumer to use the renamed API end-to-end.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/fabric/tabs/TabsHostIOSNativeComponent.ts | Renames codegen prop/type and request field to navStateRequest / baseProvenance. |
| src/fabric/tabs/TabsHostAndroidNativeComponent.ts | Same rename for Android codegen spec. |
| src/components/tabs/index.ts | Re-exports the renamed public TS type. |
| src/components/tabs/host/TabsHost.types.ts | Updates public TS types, docs, and TabsHostPropsBase prop name. |
| src/components/tabs/host/TabsHost.ios.tsx | Wires navStateRequest through to the iOS native component. |
| src/components/tabs/host/TabsHost.android.tsx | Wires navStateRequest through to the Android native component. |
| ios/tabs/host/RNSTabsHostComponentView.mm | Reads navStateRequest.baseProvenance from generated props and updates pending nav op. |
| ios/tabs/host/RNSTabsHostComponentView.h | Renames the internal prop exposure to navStateRequest. |
| apps/src/shared/gamma/containers/tabs/TabsContainer.types.tsx | Updates consumer prop omissions to the new prop name. |
| apps/src/shared/gamma/containers/tabs/TabsContainer.tsx | Renames the hook and passes navStateRequest to Tabs.Host. |
| android/src/main/java/com/swmansion/rnscreens/gamma/tabs/host/TabsHostViewManager.kt | Renames the view manager setter and map key parsing (baseProvenance). |
| android/src/main/java/com/swmansion/rnscreens/gamma/tabs/host/TabsHost.kt | Renames internal members/methods holding the latest JS request. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
kligarski
approved these changes
Apr 28, 2026
Aligns the iOS ivar name with the renamed `navStateRequest` prop on RNSTabsHost. The `_js` prefix referenced the prop's prior name and is no longer meaningful.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Aligns the
TabsHostpublic API with RFC-1028's request/state distinction.The prop currently named
navStatecarries a request for a state change — not the state itself. The resulting state is delivered back to JS through theOnTabSelectedevent. Today both sides expose a field calledprovenance, but they refer to different things:Renaming the prop and field makes this distinction explicit at the API surface and prevents downstream consumers from conflating the two.
Most other RFC-1028 deliverables are already implemented (
OnTabSelected/OnTabSelectionRejected/OnTabSelectionPrevented,isNativeAction,rejectStaleNavStateUpdates, the prevention event). This PR is the remaining rename pass.No behavior change.
Changes
TabsHostNavState→TabsHostNavStateRequestprovenance→baseProvenanceon the request typenavState→navStateRequestonTabsHostPropsBasesrc/components/tabs/index.tssetNavStateRequestoverride on the ViewManager, parsesselectedScreenKey+baseProvenancefrom theReadableMap.RNSTabsHostComponentView::updateProps.TabsNavState(data class)RNSTabsNavigationStateTabSelectOp.navStatepayload (the op models a container-level state update, not a JS request)jsNavState→jsNavStateRequest,updateJSNavState→updateJSNavStateRequest_jsNavState→_jsNavStateRequest,@property navState→@property navStateRequestapps/.../TabsContainer.{tsx,types.tsx}) updated in lockstep so the workspace stays green; helper hook renameduseTabsHostNavState→useTabsHostNavStateRequest.Test plan
This is a pure rename — no behavior change is introduced. Verification focused on build/type integrity and a manual smoke test in
FabricExample:yarn check-types(library) — passes.yarn check-typesinapps/— only pre-existing, unrelated errors remain (no errors mentionnavState/TabsHostNavStateafter the rename).FabricExample— codegen regeneratesRNSTabsHostAndroidManagerInterface.setNavStateRequest(...)and theRNSTabsHostAndroidNavStateRequestStructC++ struct; the Kotlin override compiles against the new signature.pod install+ build ofFabricExample— codegen produces the renamed C++ Props member; the ObjC++ side readsnewComponentProps.navStateRequest.{selectedScreenKey,baseProvenance}.FabricExampleTabs example: drive tab changes from JS (programmatic, via the apps'TabsContainer) and from native (tab bar tap). Confirm tab selection works on both platforms andOnTabSelectedevents still fire as expected.Reviewers may want to focus on:
src/components/tabs/host/TabsHost.types.ts— public type shapesrc/fabric/tabs/TabsHostViewManager.kt::setNavStateRequestandRNSTabsHostComponentView.mm::updateProps(request'sbaseProvenanceis fed in as the constructor'sprovenance:arg on the internal state types — by design)Checklist